package com.wxd.controller;

import com.github.pagehelper.PageInfo;
import com.guigu.mapper.TGetserialMapper;
import com.guigu.pojo.TMeals;
import com.guigu.pojo.TMealsType;
import com.lc.util.Getserial;
import com.wxd.service.TMealsService;
import com.wxd.vo.PageVo;
import com.wxd.vo.TMealstype;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class TMealsControllers {
    @Resource
    TMealsService tMealsService;

    @RequestMapping("emptotal")
    public PageInfo<TMealstype> tMealsPageInfo(@RequestBody PageVo<TMealstype> pageVo){
        System.out.println("***************"+pageVo.toString());
        PageInfo<TMealstype> test=this.tMealsService.findEmpPage(pageVo);
        return test;
    }

    @RequestMapping("queryTMeals")
    public List<TMealsType> QUERYTMEALS(){

        return this.tMealsService.QueryTMeals();
    }
    //添加
    @RequestMapping("insert")
    public void TMealsInsert(@RequestBody TMeals tMeals){
        System.out.println("***************"+tMeals.toString());
        this.tMealsService.Insert(tMeals);
    }
    //修改
    @RequestMapping("update")
    public void updates(@RequestBody TMeals tMeals){
        this.tMealsService.UpdateByPrimaryKey(tMeals);
    }

    //删除
    @RequestMapping("delete")
    public void deletes(@RequestBody TMeals tMeals){

        this.tMealsService.DeleteByPrimaryKey(tMeals);
    }
}
